/**
 *
 */
package com.aulac.commons.license.server;

import java.io.IOException;
import java.io.InputStream;

import de.schlichtherle.license.KeyStoreParam;

/**
 * @author Ngo Thanh Loi
 *
 */
public final class AulacKeyStoreParam implements KeyStoreParam {
	private String alias;
	private String keystorePassword;
	private String keyPassword;
	private InputStream keystore;

	/**
	 * @param alias
	 * @param keystorePassword
	 * @param keyPassword
	 * @param keystore
	 *            the InputStream to read keystore file name
	 */
	public AulacKeyStoreParam(String alias, String keystorePassword,
			String keyPassword, InputStream keystore) {
		if (alias == null || keystorePassword == null || keyPassword == null
				|| keystore == null) {
			throw new NullParameterExecption(
					"The parameters can't set to NULL value");
		}
		this.alias = alias;
		this.keystorePassword = keystorePassword;
		this.keyPassword = keyPassword;
		this.keystore = keystore;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.schlichtherle.license.KeyStoreParam#getAlias()
	 */
	public String getAlias() {
		return alias;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.schlichtherle.license.KeyStoreParam#getKeyPwd()
	 */
	public String getKeyPwd() {
		return keyPassword;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.schlichtherle.license.KeyStoreParam#getStorePwd()
	 */
	public String getStorePwd() {
		return keystorePassword;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.schlichtherle.license.KeyStoreParam#getStream()
	 */
	public InputStream getStream() throws IOException {
		return keystore;
	}

}
